# _*_ coding: utf-8 _*_
# @Time     : 2022/7/23 11:28
# @Author   : dake
# @Email    : dake@2545923.com
# @File     : base_case.py
# @Software : PyCharm
from appium import webdriver
import unittest
from time import sleep

class BaseCase(unittest.TestCase):
    """测试用例基类"""

    def setUp(self) -> None:
        desered_capabilities = {
            "platformName": "Android",  # 模拟器或真机的系统
            "deviceName": "127.0.0.1:62001",  # 系统版本号
            "platformVersion": "7.1.2",  # 设备名称，自定义设置
            "appPackage": "com.gfeng.daydaycook",  # app的包名
            "appActivity": "com.gfeng.daydaycook.activity.WelcomeActivity",  # app的activity
            "noReset": True,
            "unicodeKeyboard": True,
            "newCommandTimeout": 80,  # 等待时长
            "resetKeyboard": True  # 切换输入法
        }

        self.driver = webdriver.Remote("http://localhost:4723/wd/hub", desered_capabilities)
        self.driver.implicitly_wait(20)

    def tearDown(self) -> None:
        sleep(3)
        self.driver.quit()